import { createRouter, createWebHistory } from 'vue-router'


// const originalPush = VueRouter.prototype.push
// VueRouter.prototype.push = function push(location) {
// 	return originalPush.call(this, location).catch(err => err)
// }

const routes = [
	{
		path:'/login/handlerqqlogin',
		name:'handlerqqlogin',
		component:()=>import('@/views/Login/handleQQLogin.vue')
	},
	{
		path:'/',
		name:'Search',
		component:()=>import('@/views/search.vue')
	},{
		path:'/site',
		name:'Site',
		component:()=>import('@/views/site2.vue')
	}
	// ,{
	// 	path:'/site2',
	// 	name:'Site2',
	// 	component:()=>import('@/views/site2.vue')
	// },
	,{
		path:'/video',
		name:'Video',
		component:()=>import('@/views/video.vue')
	},{
		path:'/superLotto',
		name:'SuperLotto',
		component:()=>import('@/views/superLotto.vue')
	},{
		path:'/setting',
		name:'Setting',
		component:()=>import('@/views/setting.vue')
	},{
		path:'/netpan',
		name:'Netpan',
		component:()=>import('@/views/netpan.vue')
	},{
		path:'/chat',
		name:'Chat',
		component:()=>import('@/views/chat.vue')
	},{
		path:'/dev-assistant',
		name:'DevAssistant',
		component:()=>import('@/views/devAssistant.vue')
	}
]

const router = createRouter({
	history: createWebHistory(process.env.VUE_APP_ROUTER_URL),
  	routes
})
router.beforeEach((to, from, next) => {
	if (to.matched.length !== 0) {
		next()
	} else {
		next({
			path: '/'
		})
	}
});

export default router
